<!DOCTYPE HTML>
<html>
<head>
    <title>Error</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/scripts/jquery.min.js"></script>
    <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/bootstrap/skin.css">
    <script src="/scripts/miniui/miniui.js"></script>
</head>
<body>
<div id="form1" style="margin: 0 auto">
    <span style="width:80px;display:inline-block;">快递编号：</span>
    <input id="expressCode" required="true" name="refundFee" class="mini-textbox" style="width:155px;" />

    <span style="width:80px;display:inline-block;">快递公司：</span>
    <input id="logisticsCom"  class="mini-combobox" required="true" style="width:155px;" data="logisticsComStatus" />
    <br/><br/>
    <div style="padding-top: 220px;text-align: center">
        <a class="mini-button " iconCls="icon-ok" onclick="send()">发货</a>
        <a class="mini-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
    </div>
</div>
</body>
<script>
    var grid = mini.get("datagrid1");
    var logisticsComStatus = [
        { id: -1, text: '无需物流' },
        { id: "shunfeng", text: '顺丰速运'},
        { id: "annengwuliu", text: '安能快递'},
        { id: "yuantong", text: '圆通速递'},
        { id: "zhongtong", text: '中通速递'},
        { id: "shentong", text: '申通快递'},
        { id: "yunda", text: '韵达快递'},
        { id: "zhaijisong", text: '宅急送'},
        { id: "ems", text: 'EMS'},
        { id: "quanfeng", text: '全峰快递'},
        { id: "huitong", text: '百世汇通'},
        { id: "yousu", text: '优速快递'},
        { id: "kuaijie", text: '快捷快递'},
        { id: "debang", text: '德邦'},
        { id: "pingyou", text: '中国邮政'},
        { id: "tiantian", text: '天天快递'},
        { id: "wetepai", text: '微特派'},
        { id: "longbang", text: '龙邦快递'},
        { id: "suer", text: '速尔快递'},
        { id: "wanxiang", text: '万象物流'},
        { id: "guotong", text: '国通快递'},
    ];
//    var typeStatus = [{id:1, text: '买家' },{id:2, text: '卖家' },{id:3, text: '系统' }];
    mini.parse();
    var objectId = '<%= result.data[0].objectId%>';
    var sellerOId = '<%= result.data[0].sellerOId%>';
    function send() {
        var expressCode = mini.get("expressCode").getValue();
        var logisticsComCode = mini.get("logisticsCom").getValue();
        var logisticsCom = mini.get("logisticsCom").getText();
        var form = new mini.Form("#form1");
        form.validate();
        if (form.isValid() == false) return;
        form.loading("发货中");
        $.ajax({
            type: "POST",
            url: "/getdata/updateOrder/sendGoods",
            data: {
                expressCode:logisticsComCode,
                logisticsComCode:expressCode,
                logisticsCom:logisticsCom,
                orderOId:objectId,
                sellerOId:sellerOId,
            },
            success: function (result) {
                if (result==10000) {
                    CloseWindow("save");
                }else{
                    alert("发货失败");
                    CloseWindow("save");
                }
            }
        })
    }
    //    关闭窗口
    function CloseWindow(action) {
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }
    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }
</script>
</html>